JavaScript for .NET Developers by Ovais Mehboob Ahmed Khan

JavaScript for .NET Developers by Ovais Mehboob Ahmed Khan
Author: Ovais Mehboob Ahmed Khan [Khan, Ovais Mehboob Ahmed]
Language: eng
Format: azw3, epub, mobi
Publisher: Packt Publishing
Published: 2016-07-28

In the preceding code, first we imported the RouteConfig and ROUTER_DIRECTIVES from angular2/router and then defined the RouteConfig for page 1 and page 2. In the inline template, we placed the anchor tag and defined the route name for page 2. When the application runs, page 1 is set as a default page on a root path /, so the page 1 content will be displayed in place of the router outlet. When the user clicks on the Page2 link, the page 2 content will be rendered in the same place.

Here is the code of page1.component.ts:

//page1.component.ts import {Component} from 'angular2/core'; @Component({ template:'<h1>Page1 Content</h1>' }) export class Page1Component { }